﻿@model DLMemberPointMS.Entity.POCOModel.Shops

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <script src="~/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="~/layui/jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
    <title>分配管理员</title>
    <style>
        .layui-form-label {
            width: 100px
        }
    </style>
</head>
<body>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>分配管理员</legend>
    </fieldset>
    @using (Html.BeginForm())
    {
        <div class="layui-form-item">
            <label class="layui-form-label">用户名:</label>
            <div class="layui-input-inline">
                <input name="title" class="layui-input" id="Name" type="text" placeholder="请输入用户名" autocomplete="off" lay-verify="title">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="submitform" id="BtnAdd">分配店长的账号</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <label style="color:red;">账号的默认密码为:123456</label>
            </div>
        </div>
        @Html.HiddenFor(Model => Model.S_ID)
    }
    <script>
        layui.use(['form', 'layer'], function () {
            var form = layui.form;
            var layer = layui.layer;//弹窗
            var i = parent.layer.getFrameIndex(window.name);
            $("#BtnAdd").click(function () {
                //分配管理员方法
                var url = "/Shops/shopAssign/";
                var Name = $("#Name").val();
                var S_ID = $("#S_ID").val();
                $.ajax({
                    type: "post",
                    url: url,
                    data: { Name: Name, S_ID: S_ID },
                    success: function (res) {
                        if (res.code == 0) {

                            parent.layer.msg(res.msg, { icon: 1 });
                            parent.layer.close(i); //再执行关闭

                        } else {
                            parent.layer.msg(res.msg, { icon: 5 });
                            parent.layer.close(i); //再执行关闭
                        }
                    },
                    error: function (res) {
                        parent.layer.msg(res.msg, { icon: 2 });
                        parent.layer.close(i); //再执行关闭

                    }
                })
                return false;
            })
        })
    </script>
</body>
</html>
